package com.zm.demo.spring.ioc.factorybean;

import com.zm.demo.spring.ioc.po.User;
import com.zm.demo.spring.ioc.po.UserPO1;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.config.AbstractFactoryBean;

public class MyFactoryBean extends AbstractFactoryBean<User> {

    @Override
    protected void destroyInstance(User instance) throws Exception {
        super.destroyInstance(instance);
    }

    @Override
    public Class<?> getObjectType() {
        return UserPO1.class;
    }

    @Override
    protected User createInstance() throws Exception {
        UserPO1 userPO1 = new UserPO1();
        userPO1.setName("zm2");
        userPO1.setAge(2);
        return userPO1;
    }
}
